home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / httpext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  9.8 KB  |  275 lines

  1. /********
  2. *
  3. *  Copyright (c) 1995  Process Software Corporation
  4. *
  5. *  Copyright (c) 1995-1996  Microsoft Corporation
  6. *
  7. *
  8. *  Module Name  : HttpExt.h
  9. *
  10. *  Abstract :
  11. *
  12. *     This module contains  the structure definitions and prototypes for the
  13. *     version 2.0 HTTP Server Extension interface.
  14. *
  15. ******************/
  16.  
  17. #ifndef _HTTPEXT_H_
  18. #define _HTTPEXT_H_
  19.  
  20. #include <windows.h>
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. #define   HSE_VERSION_MAJOR           2      // major version of this spec
  27. #define   HSE_VERSION_MINOR           0      // minor version of this spec
  28. #define   HSE_LOG_BUFFER_LEN         80
  29. #define   HSE_MAX_EXT_DLL_NAME_LEN  256
  30.  
  31. typedef   LPVOID  HCONN;
  32.  
  33. // the following are the status codes returned by the Extension DLL
  34.  
  35. #define   HSE_STATUS_SUCCESS                       1
  36. #define   HSE_STATUS_SUCCESS_AND_KEEP_CONN         2
  37. #define   HSE_STATUS_PENDING                       3
  38. #define   HSE_STATUS_ERROR                         4
  39.  
  40. // The following are the values to request services with the ServerSupportFunction.
  41. //  Values from 0 to 1000 are reserved for future versions of the interface
  42.  
  43. #define   HSE_REQ_BASE                             0
  44. #define   HSE_REQ_SEND_URL_REDIRECT_RESP           ( HSE_REQ_BASE + 1 )
  45. #define   HSE_REQ_SEND_URL                         ( HSE_REQ_BASE + 2 )
  46. #define   HSE_REQ_SEND_RESPONSE_HEADER             ( HSE_REQ_BASE + 3 )
  47. #define   HSE_REQ_DONE_WITH_SESSION                ( HSE_REQ_BASE + 4 )
  48. #define   HSE_REQ_END_RESERVED                     1000
  49.  
  50. //
  51. //  These are Microsoft specific extensions
  52. //
  53.  
  54. #define   HSE_REQ_MAP_URL_TO_PATH                  (HSE_REQ_END_RESERVED+1)
  55. #define   HSE_REQ_GET_SSPI_INFO                    (HSE_REQ_END_RESERVED+2)
  56. #define   HSE_APPEND_LOG_PARAMETER                 (HSE_REQ_END_RESERVED+3)
  57. #define   HSE_REQ_SEND_URL_EX                      (HSE_REQ_END_RESERVED+4)
  58. #define   HSE_REQ_IO_COMPLETION                    (HSE_REQ_END_RESERVED+5)
  59. #define   HSE_REQ_TRANSMIT_FILE                    (HSE_REQ_END_RESERVED+6)
  60. #define   HSE_REQ_REFRESH_ISAPI_ACL                (HSE_REQ_END_RESERVED+7)
  61.  
  62. //
  63. //  Bit Flags for TerminateExtension
  64. //
  65. //    HSE_TERM_ADVISORY_UNLOAD - Server wants to unload the extension,
  66. //          extension can return TRUE if OK, FALSE if the server should not
  67. //          unload the extension
  68. //
  69. //    HSE_TERM_MUST_UNLOAD - Server indicating the extension is about to be
  70. //          unloaded, the extension cannot refuse.
  71. //
  72.  
  73. #define HSE_TERM_ADVISORY_UNLOAD                   0x00000001
  74. #define HSE_TERM_MUST_UNLOAD                       0x00000002
  75.  
  76.  
  77. //
  78. // Flags for IO Functions, supported for IO Funcs.
  79. //  TF means ServerSupportFunction( HSE_REQ_TRANSMIT_FILE)
  80. //
  81.  
  82. # define HSE_IO_SYNC                      0x00000001   // for WriteClient
  83. # define HSE_IO_ASYNC                     0x00000002   // for WriteClient/TF
  84. # define HSE_IO_DISCONNECT_AFTER_SEND     0x00000004   // for TF
  85. # define HSE_IO_SEND_HEADERS              0x00000008   // for TF
  86.  
  87.  
  88.  
  89. //
  90. // passed to GetExtensionVersion
  91. //
  92.  
  93. #ifdef UNDER_CE
  94. typedef struct   _HSE_VERSION_INFO {
  95.  
  96.     DWORD  dwExtensionVersion;
  97.     TCHAR   lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN];
  98.  
  99. } HSE_VERSION_INFO, *LPHSE_VERSION_INFO;
  100. #else
  101. typedef struct   _HSE_VERSION_INFO {
  102.  
  103.     DWORD  dwExtensionVersion;
  104.     CHAR   lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN];
  105.  
  106. } HSE_VERSION_INFO, *LPHSE_VERSION_INFO;
  107. #endif
  108.  
  109.  
  110.  
  111. //
  112. // passed to extension procedure on a new request
  113. //
  114. #ifdef UNDER_CE
  115. typedef struct _EXTENSION_CONTROL_BLOCK {
  116.  
  117.     DWORD     cbSize;                 // size of this struct.
  118.     DWORD     dwVersion;              // version info of this spec
  119.     HCONN     ConnID;                 // Context number not to be modified!
  120.     DWORD     dwHttpStatusCode;       // HTTP Status code
  121.     WCHAR      lpszLogData[HSE_LOG_BUFFER_LEN];// null terminated log info specific to this Extension DLL
  122.     
  123.     LPWSTR     lpszMethod;             // REQUEST_METHOD
  124.     LPWSTR     lpszQueryString;        // QUERY_STRING
  125.     LPWSTR     lpszPathInfo;           // PATH_INFO
  126.     LPWSTR     lpszPathTranslated;     // PATH_TRANSLATED
  127.  
  128.     DWORD     cbTotalBytes;           // Total bytes indicated from client
  129.     DWORD     cbAvailable;            // Available number of bytes
  130.     LPBYTE    lpbData;                // pointer to cbAvailable bytes
  131.  
  132.     LPWSTR     lpszContentType;        // Content type of client data
  133.  
  134.     BOOL (WINAPI * GetServerVariable) ( HCONN       hConn,
  135.                                         LPWSTR       lpszVariableName,
  136.                                         LPVOID      lpvBuffer,
  137.                                         LPDWORD     lpdwSize );
  138.  
  139.     BOOL (WINAPI * WriteClient)  ( HCONN      ConnID,
  140.                                    LPVOID     Buffer,
  141.                                    LPDWORD    lpdwBytes,
  142.                                    DWORD      dwReserved );
  143.  
  144.     BOOL (WINAPI * ReadClient)  ( HCONN      ConnID,
  145.                                   LPVOID     lpvBuffer,
  146.                                   LPDWORD    lpdwSize );
  147.  
  148.     BOOL (WINAPI * ServerSupportFunction)( HCONN      hConn,
  149.                                            DWORD      dwHSERRequest,
  150.                                            LPVOID     lpvBuffer,
  151.                                            LPDWORD    lpdwSize,
  152.                                            LPDWORD    lpdwDataType );
  153.  
  154. } EXTENSION_CONTROL_BLOCK, *LPEXTENSION_CONTROL_BLOCK;
  155.  
  156. #else
  157. typedef struct _EXTENSION_CONTROL_BLOCK {
  158.  
  159.     DWORD     cbSize;                 // size of this struct.
  160.     DWORD     dwVersion;              // version info of this spec
  161.     HCONN     ConnID;                 // Context number not to be modified!
  162.     DWORD     dwHttpStatusCode;       // HTTP Status code
  163.     CHAR      lpszLogData[HSE_LOG_BUFFER_LEN];// null terminated log info specific to this Extension DLL
  164.  
  165.     LPSTR     lpszMethod;             // REQUEST_METHOD
  166.     LPSTR     lpszQueryString;        // QUERY_STRING
  167.     LPSTR     lpszPathInfo;           // PATH_INFO
  168.     LPSTR     lpszPathTranslated;     // PATH_TRANSLATED
  169.  
  170.     DWORD     cbTotalBytes;           // Total bytes indicated from client
  171.     DWORD     cbAvailable;            // Available number of bytes
  172.     LPBYTE    lpbData;                // pointer to cbAvailable bytes
  173.  
  174.     LPSTR     lpszContentType;        // Content type of client data
  175.  
  176.     BOOL (WINAPI * GetServerVariable) ( HCONN       hConn,
  177.                                         LPSTR       lpszVariableName,
  178.                                         LPVOID      lpvBuffer,
  179.                                         LPDWORD     lpdwSize );
  180.  
  181.     BOOL (WINAPI * WriteClient)  ( HCONN      ConnID,
  182.                                    LPVOID     Buffer,
  183.                                    LPDWORD    lpdwBytes,
  184.                                    DWORD      dwReserved );
  185.  
  186.     BOOL (WINAPI * ReadClient)  ( HCONN      ConnID,
  187.                                   LPVOID     lpvBuffer,
  188.                                   LPDWORD    lpdwSize );
  189.  
  190.     BOOL (WINAPI * ServerSupportFunction)( HCONN      hConn,
  191.                                            DWORD      dwHSERRequest,
  192.                                            LPVOID     lpvBuffer,
  193.                                            LPDWORD    lpdwSize,
  194.                                            LPDWORD    lpdwDataType );
  195.  
  196. } EXTENSION_CONTROL_BLOCK, *LPEXTENSION_CONTROL_BLOCK;
  197. #endif
  198.  
  199. //
  200. //  these are the prototypes that must be exported from the extension DLL
  201. //
  202.  
  203. BOOL  WINAPI   GetExtensionVersion( HSE_VERSION_INFO  *pVer );
  204. DWORD WINAPI   HttpExtensionProc(  EXTENSION_CONTROL_BLOCK *pECB );
  205. BOOL  WINAPI   TerminateExtension( DWORD dwFlags );
  206.  
  207. // the following type declarations is for the server side
  208.  
  209. typedef BOOL  (WINAPI * PFN_GETEXTENSIONVERSION)( HSE_VERSION_INFO  *pVer );
  210. typedef DWORD (WINAPI * PFN_HTTPEXTENSIONPROC )( EXTENSION_CONTROL_BLOCK *pECB );
  211. typedef BOOL  (WINAPI * PFN_TERMINATEEXTENSION )( DWORD dwFlags );
  212.  
  213. typedef VOID
  214.   (WINAPI * PFN_HSE_IO_COMPLETION)(
  215.                                    IN EXTENSION_CONTROL_BLOCK * pECB,
  216.                                    IN PVOID    pContext,
  217.                                    IN DWORD    cbIO,
  218.                                    IN DWORD    dwError
  219.                                    );
  220.  
  221.  
  222.  
  223.  
  224. //
  225. // HSE_TF_INFO defines the type for HTTP SERVER EXTENSION support for
  226. //  ISAPI applications to send files using TransmitFile.
  227. // A pointer to this object should be used with ServerSupportFunction()
  228. //  for HSE_REQ_TRANSMIT_FILE.
  229. //
  230.  
  231. typedef struct _HSE_TF_INFO  {
  232.  
  233.     //
  234.     // callback and context information
  235.     // the callback function will be called when IO is completed.
  236.     // the context specified will be used during such callback.
  237.     //
  238.     // These values (if non-NULL) will override the one set by calling
  239.     //  ServerSupportFunction() with HSE_REQ_IO_COMPLETION
  240.     //
  241.     PFN_HSE_IO_COMPLETION   pfnHseIO;
  242.     PVOID  pContext;
  243.  
  244.     // file should have been opened with FILE_FLAG_SEQUENTIAL_SCAN
  245.     HANDLE hFile;
  246.  
  247.     //
  248.     // HTTP header and status code
  249.     // These fields are used only if HSE_IO_SEND_HEADERS is present in dwFlags
  250.     //
  251.  
  252.     LPCSTR pszStatusCode; // HTTP Status Code  eg: "200 OK"
  253.  
  254.     DWORD  BytesToWrite;  // special value of "0" means write entire file.
  255.     DWORD  Offset;        // offset value within the file to start from
  256.  
  257.     PVOID  pHead;         // Head buffer to be sent before file data
  258.     DWORD  HeadLength;    // header length
  259.     PVOID  pTail;         // Tail buffer to be sent after file data
  260.     DWORD  TailLength;    // tail length
  261.  
  262.     DWORD  dwFlags;       // includes HSE_IO_DISCONNECT_AFTER_SEND, ...
  263.  
  264. } HSE_TF_INFO, * LPHSE_TF_INFO;
  265.  
  266.  
  267.  
  268.  
  269.  
  270. #ifdef __cplusplus
  271. }
  272. #endif
  273.  
  274. #endif  // end definition _HTTPEXT_H_
  275.